/********************************************************************************
*																				*
*  Las Venturas Playground - Handlers/taxi.nut									*
*																				*
*  The taxi handler is located here.											*
*																				*
********************************************************************************/

function onPlayerCommand(playerid, command)
{
	local cmd = split(command, " ");

	// Command: /locations
	// Params: void
	// Author: Sander
	
	if( cmd[0] == "/locations" )
	{
		sendPlayerMessage(playerid, "The following taxi locations are available:", 0xFF9900FF, true);
		sendPlayerMessage(playerid, "1: Middle Park 2: Liberty City Statue 3: Parking Lot 4: Meadow Park 5: Francis International Airport Terminal", 0xFFFFFF00, true);
		sendPlayerMessage(playerid, "6: Star Junction 7: Port Tudor 8: Alderney State Correctional Facility 9: Charge Island 10: Bohan", 0xFFFFFF00, true);
		return 1;
	}

	// Command: /testtaxi
	// Params: (int) taxi location
	// Author: Sander
	
	if( cmd[0] == "/testtaxi" )
	{
		local taxiArray = [
		"-235.249405, 787.059387, 7.176558",
		"-607.505005, -797.401123, 13.071271",
		"58.488483, 1115.379395, 3.166998"
		]
	
		sendPlayerMessage(playerid, "[FF0000FF]Debug: "+ taxiArray[(cmd[1].tointeger())] +".", 0xFFFFFFFF, true);
		return 1;
	}
	
	// Command: /t or /taxi
	// Params: (int) taxi location
	// Author: Sander
	
	if(cmd[0] == "/t" || cmd[0] == "/taxi")
	{
		if(cmd.len() == 2)
		{
			switch( (cmd[1].tointeger() ))
			{
				case 1: // Middle Park
					setPlayerCoordinates(playerid, -235.249405, 787.059387, 7.176558); 
					setPlayerHeading ( playerid, 356.865570 );
					setCameraBehindPlayer ( playerid );
					break;
				case 2: // Liberty City Statue
					setPlayerCoordinates(playerid, -607.505005, -797.401123, 13.071271); 
					setPlayerHeading ( playerid, 356.865570 );
					setCameraBehindPlayer ( playerid );
					break;
				case 3: // Parking Lot
					setPlayerCoordinates(playerid, 58.488483, 1115.379395, 3.166998); 
					setPlayerHeading ( playerid, 320.843933 );
					setCameraBehindPlayer ( playerid );
					break;
				case 4: // Meadow Park
					setPlayerCoordinates(playerid, 1488.925659, 682.255371, 32.499546);
					setPlayerHeading ( playerid, 177.0 );
					setCameraBehindPlayer ( playerid );
					break;
				case 5: // Francis International Airport Terminal
					setPlayerCoordinates(playerid, 2341.902100, 406.600677, 6.085224);
					setPlayerHeading ( playerid, 300.0 );
					setCameraBehindPlayer ( playerid );
					break;
				case 6: // Star Junction / The Triangle
					setPlayerCoordinates(playerid, -187.772598, 127.328476, 14.762892);
					setPlayerHeading ( playerid, 185.0 );
					setCameraBehindPlayer ( playerid );
					break;
				case 7: // Port Tudor
					setPlayerCoordinates(playerid, -1111.971191, 132.896622, 4.237916);
					setPlayerHeading ( playerid, 330.0 );
					setCameraBehindPlayer ( playerid );
					break;
				case 8: // Alderney State Correctional Facility
					setPlayerCoordinates(playerid, -973.851318, -394.871704, 13.503224);
					setPlayerHeading ( playerid, 270.0 );
					setCameraBehindPlayer ( playerid );
					break;
				case 9: // Charge Island
					setPlayerCoordinates(playerid, 582.442139, 944.412415, 2.743941);
					setPlayerHeading ( playerid, 208.0 );
					setCameraBehindPlayer ( playerid );
					break;
				case 10: // Bohan
					setPlayerCoordinates(playerid, 635.831299, 1784.200806, 38.490875);
					setPlayerHeading ( playerid, 90.0 );
					setCameraBehindPlayer ( playerid );
					break;
			}
		}
		else
		{
			sendPlayerMessage(playerid, "[FF0000FF]* Usage: [FFFF0000]/taxi [Location] [FF0000FF]See /locations for taxi locations.", 0xFFFFFFFF, true);
		}
		return 1;
	}	
}

addEvent("playerCommand", onPlayerCommand);
